{% extends "usercenter/base.html" %}
{% block content %}
<div class="col-md-3">&nbsp;</div>
<div class="col-md-6">
  <div class="hidden-xs alert alert-success text-center">
    <h2 style="font-weight:100;">登&nbsp;&nbsp;&nbsp;&nbsp;录</h2>
  </div>
  <div class="well">
    <form id="login-form" role="form" action="." method="post" class="form-horizontal">
      {% csrf_token %}
      <div class="form-group {% if form.errors %}error{% endif %}">
        <label for="id_captcha" class="share-label col-sm-2">验证码</label>
        <div id="CAPTCHA" data-url="{% url 'captcha-refresh' %}" class="col-sm-10">
          {{form.captcha}}
        </div>
      </div>
      <div class="form-group {% if form.errors %}error{% endif %}">
        <label for="id_username" class="share-label col-sm-2">用户名</label>
        <div class="col-sm-10">
          <input id="id_username" maxlength="254" name="username" type="text" class="form-control"/>
        </div>
      </div>
      <div class="form-group {% if form.errors %}error{% endif %}">
        <label for="id_password" class="share-label col-sm-2">密码</label>
        <div class="col-sm-10">
          <input id="id_password" name="password" type="password" class="form-control"/>
        </div>
      </div>
      <input type="hidden" name="this_is_the_login_form" value="1"/>
      <input type="hidden" name="next" value="{{ next }}"/>
      <button id="login" type="submit" class="btn btn-large btn-primary btn-block">登录</button>
      {% if form.errors %}
      <div class="alert alert-danger text-center">
        {% if form.captcha.errors %}
        <p>验证码错误</p>
        {% else %}
        <p>用户名或密码错误</p>
        {% endif %}
      </div>
      {% endif %}
    </form>
  </div>
  <div style="margin-bottom: 20px;" class="hidden-xs text-center">
    <a href="{% url 'password_reset' %}">找回密码</a>
  </div>
</div>
<div class="col-md-3">&nbsp;</div>
{% endblock %}
